package com.idc.quotation.controller;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.idc.common.config.AppConfig;
import com.idc.common.mvc.vo.ResponseVo;

@RestController
@RequestMapping("/appConfig")
public class AppConfigController {
	
	@Autowired
	private AppConfig appConfig;
	
	@RequestMapping("/getAppConfig")
	public ResponseVo<?> getAppConfig(){
		return ResponseVo.success(appConfig.getAppConfigrationVo());
	}
	
    @InitBinder
	public void initBinder(WebDataBinder binder) {
		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		dateFormat.setLenient(false);
		binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
		binder.setDisallowedFields(new String[] {});
	}

}
